package com.wll.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * 时间工具类
 *
 * created by detachment on 2020/6/2
 */
public class DateTimeUtil {
    private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yy-MM-dd", Locale.SIMPLIFIED_CHINESE);
    private static final SimpleDateFormat TIME_FORMAT = new SimpleDateFormat("yyyyMMdd_HH_mm_ss", Locale.SIMPLIFIED_CHINESE);

    /**
     * 获取一个简单的时间字符串
     *
     * @param date Date
     * @return 时间字符串
     */
    public static String getSampleDate(Date date) {
        return DATE_FORMAT.format(date);
    }

    public static String getSampleTime(Date date) {
        return TIME_FORMAT.format(date);
    }
}
